Plotly is a powerful data visualization library that offers a wide range of features and customization options.
One of the most important aspects of creating visually appealing and effective plots is the selection of colors.
Plotly offers a variety of color palettes, also known as cmaps, that can be used to style and customize different types of plots. These cmaps include a range of color schemes that can be used for different purposes, such as highlighting trends, grouping data, and creating gradients.
In this way, the use of color can greatly enhance the clarity and interpretability of your visualizations. Understanding the available color palettes and how to use them effectively is an important part of creating effective data visualizations with Plotly.
In this context, Plotly Express provides a simple and intuitive way to select and apply different cmaps to your plots, making it easy to create stunning visualizations that communicate your message effectively.
Plotly Express provides a variety of datasets that can be used to create example visualizations and explore the capabilities of the library. Two popular datasets that are often used for this purpose are iris and election.
The iris dataset is a classic example in data science and machine learning, and is widely used as a benchmark for classification and clustering algorithms. It contains measurements of the sepal length, sepal width, petal length, and petal width for 150 samples of iris flowers, belonging to three different species: Iris setosa, Iris versicolor, and Iris virginica. In Plotly Express, this dataset can be loaded using the px.data.iris() function, and can be used to create a wide range of visualizations, such as scatter plots, box plots, or histograms.
import pandas as pd
import plotly.express as xp
df = xp.data.iris()
df.head(50)
| sepal_length | sepal_width | petal_length | petal_width | species | species_id | |
|---|---|---|---|---|---|---|
| 0 | 5.1 | 3.5 | 1.4 | 0.2 | setosa | 1 |
| 1 | 4.9 | 3.0 | 1.4 | 0.2 | setosa | 1 |
| 2 | 4.7 | 3.2 | 1.3 | 0.2 | setosa | 1 |
| 3 | 4.6 | 3.1 | 1.5 | 0.2 | setosa | 1 |
| 4 | 5.0 | 3.6 | 1.4 | 0.2 | setosa | 1 |
| 5 | 5.4 | 3.9 | 1.7 | 0.4 | setosa | 1 |
| 6 | 4.6 | 3.4 | 1.4 | 0.3 | setosa | 1 |
| 7 | 5.0 | 3.4 | 1.5 | 0.2 | setosa | 1 |
| 8 | 4.4 | 2.9 | 1.4 | 0.2 | setosa | 1 |
| 9 | 4.9 | 3.1 | 1.5 | 0.1 | setosa | 1 |
| 10 | 5.4 | 3.7 | 1.5 | 0.2 | setosa | 1 |
| 11 | 4.8 | 3.4 | 1.6 | 0.2 | setosa | 1 |
| 12 | 4.8 | 3.0 | 1.4 | 0.1 | setosa | 1 |
| 13 | 4.3 | 3.0 | 1.1 | 0.1 | setosa | 1 |
| 14 | 5.8 | 4.0 | 1.2 | 0.2 | setosa | 1 |
| 15 | 5.7 | 4.4 | 1.5 | 0.4 | setosa | 1 |
| 16 | 5.4 | 3.9 | 1.3 | 0.4 | setosa | 1 |
| 17 | 5.1 | 3.5 | 1.4 | 0.3 | setosa | 1 |
| 18 | 5.7 | 3.8 | 1.7 | 0.3 | setosa | 1 |
| 19 | 5.1 | 3.8 | 1.5 | 0.3 | setosa | 1 |
| 20 | 5.4 | 3.4 | 1.7 | 0.2 | setosa | 1 |
| 21 | 5.1 | 3.7 | 1.5 | 0.4 | setosa | 1 |
| 22 | 4.6 | 3.6 | 1.0 | 0.2 | setosa | 1 |
| 23 | 5.1 | 3.3 | 1.7 | 0.5 | setosa | 1 |
| 24 | 4.8 | 3.4 | 1.9 | 0.2 | setosa | 1 |
| 25 | 5.0 | 3.0 | 1.6 | 0.2 | setosa | 1 |
| 26 | 5.0 | 3.4 | 1.6 | 0.4 | setosa | 1 |
| 27 | 5.2 | 3.5 | 1.5 | 0.2 | setosa | 1 |
| 28 | 5.2 | 3.4 | 1.4 | 0.2 | setosa | 1 |
| 29 | 4.7 | 3.2 | 1.6 | 0.2 | setosa | 1 |
| 30 | 4.8 | 3.1 | 1.6 | 0.2 | setosa | 1 |
| 31 | 5.4 | 3.4 | 1.5 | 0.4 | setosa | 1 |
| 32 | 5.2 | 4.1 | 1.5 | 0.1 | setosa | 1 |
| 33 | 5.5 | 4.2 | 1.4 | 0.2 | setosa | 1 |
| 34 | 4.9 | 3.1 | 1.5 | 0.1 | setosa | 1 |
| 35 | 5.0 | 3.2 | 1.2 | 0.2 | setosa | 1 |
| 36 | 5.5 | 3.5 | 1.3 | 0.2 | setosa | 1 |
| 37 | 4.9 | 3.1 | 1.5 | 0.1 | setosa | 1 |
| 38 | 4.4 | 3.0 | 1.3 | 0.2 | setosa | 1 |
| 39 | 5.1 | 3.4 | 1.5 | 0.2 | setosa | 1 |
| 40 | 5.0 | 3.5 | 1.3 | 0.3 | setosa | 1 |
| 41 | 4.5 | 2.3 | 1.3 | 0.3 | setosa | 1 |
| 42 | 4.4 | 3.2 | 1.3 | 0.2 | setosa | 1 |
| 43 | 5.0 | 3.5 | 1.6 | 0.6 | setosa | 1 |
| 44 | 5.1 | 3.8 | 1.9 | 0.4 | setosa | 1 |
| 45 | 4.8 | 3.0 | 1.4 | 0.3 | setosa | 1 |
| 46 | 5.1 | 3.8 | 1.6 | 0.2 | setosa | 1 |
| 47 | 4.6 | 3.2 | 1.4 | 0.2 | setosa | 1 |
| 48 | 5.3 | 3.7 | 1.5 | 0.2 | setosa | 1 |
| 49 | 5.0 | 3.3 | 1.4 | 0.2 | setosa | 1 |
The election dataset, on the other hand, is a more recent and politically-oriented dataset that contains information on the 2012 US presidential election results at the county level. It includes data on the percentage of votes cast for each candidate, as well as demographic information such as population density, income, and race. This dataset can be loaded using the px.data.election() function in Plotly Express, and can be used to create a range of visualizations, such as choropleth maps, pie charts, and scatter plots.
df2 = xp.data.election()
df2 = df2.groupby('district', as_index=False).head(1).sort_values('total'
, ascending=False)
df2
| district | Coderre | Bergeron | Joly | total | winner | result | district_id | |
|---|---|---|---|---|---|---|---|---|
| 11 | 131-Saint-Édouard | 1827 | 6408 | 2815 | 11050 | Bergeron | majority | 131 |
| 12 | 132-Étienne-Desmarteau | 2331 | 5748 | 2788 | 10867 | Bergeron | majority | 132 |
| 13 | 133-Vieux-Rosemont | 2670 | 4962 | 3234 | 10866 | Bergeron | plurality | 133 |
| 29 | 193-Villeray | 2201 | 5819 | 2782 | 10802 | Bergeron | majority | 193 |
| 4 | 112-DeLorimier | 1770 | 5933 | 3044 | 10747 | Bergeron | majority | 112 |
| 7 | 121-La Pointe-aux-Prairies | 5456 | 1760 | 3330 | 10546 | Coderre | majority | 121 |
| 48 | 71-Tétreaultville | 3694 | 2589 | 3454 | 9737 | Coderre | plurality | 71 |
| 16 | 141-Côte-de-Liesse | 4308 | 1320 | 3959 | 9587 | Coderre | plurality | 141 |
| 42 | 51-Sault-Saint-Louis | 4201 | 1642 | 3717 | 9560 | Coderre | plurality | 51 |
| 8 | 122-Pointe-aux-Trembles | 4734 | 1879 | 2852 | 9465 | Coderre | majority | 122 |
| 20 | 161-Saint-HenriPetite-BourgognePointe-Saint-Ch... | 2432 | 3368 | 3578 | 9378 | Joly | plurality | 161 |
| 10 | 13-Ahuntsic | 2979 | 3430 | 2873 | 9282 | Bergeron | plurality | 13 |
| 14 | 134-Marie-Victorin | 3673 | 3155 | 2431 | 9259 | Coderre | plurality | 134 |
| 22 | 171-ChamplainL'Île-des-Soeurs | 3347 | 2562 | 3291 | 9200 | Coderre | plurality | 171 |
| 49 | 72-MaisonneuveLongue-Pointe | 2746 | 3250 | 3139 | 9135 | Bergeron | plurality | 72 |
| 52 | 81-Marie-Clarac | 6591 | 1085 | 1435 | 9111 | Coderre | majority | 81 |
| 3 | 111-Mile-End | 1734 | 4782 | 2514 | 9030 | Bergeron | majority | 111 |
| 2 | 11-Sault-au-Récollet | 3348 | 2770 | 2532 | 8650 | Coderre | plurality | 11 |
| 19 | 152-Saint-Léonard-Ouest | 5387 | 1184 | 1908 | 8479 | Coderre | majority | 152 |
| 17 | 142-Norman-McLaren | 4104 | 1459 | 2822 | 8385 | Coderre | plurality | 142 |
| 9 | 123-Rivière-des-Prairies | 5737 | 958 | 1656 | 8351 | Coderre | majority | 123 |
| 6 | 12-Saint-Sulpice | 3252 | 2521 | 2543 | 8316 | Coderre | plurality | 12 |
| 53 | 82-Ovide-Clermont | 6229 | 780 | 1051 | 8060 | Coderre | majority | 82 |
| 51 | 74-Louis-Riel | 3509 | 2178 | 2338 | 8025 | Coderre | plurality | 74 |
| 23 | 172-Desmarchais-Crawford | 2476 | 2631 | 2849 | 7956 | Joly | plurality | 172 |
| 50 | 73-Hochelaga | 1546 | 3679 | 2675 | 7900 | Bergeron | plurality | 73 |
| 43 | 52-Cecil-P.-Newman | 3536 | 1330 | 2943 | 7809 | Coderre | plurality | 52 |
| 37 | 34-Notre-Dame-de-Grâce | 1773 | 2653 | 3262 | 7688 | Joly | plurality | 34 |
| 28 | 192-François-Perrault | 2878 | 2666 | 2039 | 7583 | Coderre | plurality | 192 |
| 5 | 113-Jeanne-Mance | 1455 | 3599 | 2316 | 7370 | Bergeron | plurality | 113 |
| 0 | 101-Bois-de-Liesse | 2481 | 1829 | 3024 | 7334 | Joly | plurality | 101 |
| 15 | 14-Bordeaux-Cartierville | 3612 | 1554 | 2081 | 7247 | Coderre | plurality | 14 |
| 21 | 162-Saint-PaulÉmard | 2566 | 2092 | 2438 | 7096 | Coderre | plurality | 162 |
| 18 | 151-Saint-Léonard-Est | 3931 | 882 | 1641 | 6454 | Coderre | majority | 151 |
| 26 | 183-Sainte-Marie | 1347 | 2827 | 2271 | 6445 | Bergeron | plurality | 183 |
| 1 | 102-Cap-Saint-Jacques | 2525 | 1163 | 2675 | 6363 | Joly | plurality | 102 |
| 25 | 182-Saint-Jacques | 1906 | 2169 | 2282 | 6357 | Joly | plurality | 182 |
| 38 | 35-Loyola | 2040 | 1437 | 2648 | 6125 | Joly | plurality | 35 |
| 27 | 191-Saint-Michel | 3668 | 984 | 1220 | 5872 | Coderre | majority | 191 |
| 30 | 194-Parc-Extension | 2420 | 1793 | 1402 | 5615 | Coderre | plurality | 194 |
| 35 | 32-Côte-des-Neiges | 1644 | 1950 | 1578 | 5172 | Bergeron | plurality | 32 |
| 36 | 33-Snowdon | 1548 | 1503 | 1636 | 4687 | Joly | plurality | 33 |
| 33 | 23-Centre | 2526 | 851 | 1286 | 4663 | Coderre | majority | 23 |
| 41 | 43-Fort-Rolland | 1325 | 1205 | 1908 | 4438 | Joly | plurality | 43 |
| 34 | 31-Darlington | 1873 | 1182 | 1232 | 4287 | Coderre | plurality | 31 |
| 24 | 181-Peter-McGill | 1451 | 754 | 1894 | 4099 | Joly | plurality | 181 |
| 31 | 21-Ouest | 2184 | 691 | 1076 | 3951 | Coderre | majority | 21 |
| 32 | 22-Est | 1589 | 708 | 1172 | 3469 | Coderre | plurality | 22 |
| 39 | 41-du Canal | 1165 | 832 | 1266 | 3263 | Joly | plurality | 41 |
| 40 | 42-J.-Émery-Provost | 1193 | 653 | 1157 | 3003 | Coderre | plurality | 42 |
| 54 | 91-Claude-Ryan | 996 | 643 | 423 | 2062 | Coderre | plurality | 91 |
| 55 | 92-Joseph-Beaubien | 540 | 833 | 592 | 1965 | Bergeron | plurality | 92 |
| 45 | 62-Denis-Benjamin-Viger | 595 | 226 | 1068 | 1889 | Joly | majority | 62 |
| 44 | 61-Pierre-Foretier | 631 | 258 | 998 | 1887 | Joly | majority | 61 |
| 57 | 94-Jeanne-Sauvé | 491 | 698 | 489 | 1678 | Bergeron | plurality | 94 |
| 46 | 63-Jacques-Bizard | 518 | 224 | 690 | 1432 | Joly | plurality | 63 |
| 56 | 93-Robert-Bourassa | 446 | 465 | 419 | 1330 | Bergeron | plurality | 93 |
| 47 | 64-Sainte-Geneviève | 332 | 131 | 326 | 789 | Coderre | plurality | 64 |
Both of these datasets provide rich and interesting data that can be used to explore the capabilities of Plotly and create visually appealing and informative visualizations. Additionally, Plotly provides a number of other datasets that can be used for similar purposes, such as the gapminder dataset, which contains data on the development indicators of countries over time, and the tips dataset, which contains data on restaurant tips and bills. These datasets can be accessed using the px.data module in Plotly, making it easy to experiment with different types of data and create engaging visualizations.
In Plotly, the colors.sequential module provides users with a variety of pre-defined color scales that are designed for use in sequential data visualizations. These color scales are specifically created to effectively represent data sets that have a natural order, where one value is larger or smaller than another.
The colors.sequential module contains a wide range of color scales that can be used in different contexts. For example, the Blues scale includes a range of blue hues that gradually increase in intensity, making it ideal for visualizing data that increases over time or across a geographic area.
sequential.show()
This is a comprehensive dataset that includes all available color scales for the colors.sequential module in Plotly. This dataset contains color scales that are optimized for use in sequential data visualizations, making it ideal for creating informative and aesthetically pleasing plots.
The dataset includes:
sequential_df
| scale | size | codes | |
|---|---|---|---|
| 47 | Turbo | 15 | [#30123b, #4145ab, #4675ed, #39a2fc, #1bcfd4, ... |
| 31 | Plotly3 | 13 | [#0508b8, #1910d8, #3c19f0, #6b1cfb, #981cfd, ... |
| 65 | turbid | 12 | [rgb(232, 245, 171), rgb(220, 219, 137), rgb(2... |
| 58 | haline | 12 | [rgb(41, 24, 107), rgb(42, 35, 160), rgb(15, 7... |
| 53 | algae | 12 | [rgb(214, 249, 207), rgb(186, 228, 174), rgb(1... |
| 54 | amp | 12 | [rgb(241, 236, 236), rgb(230, 209, 203), rgb(2... |
| 55 | deep | 12 | [rgb(253, 253, 204), rgb(206, 236, 179), rgb(1... |
| 56 | dense | 12 | [rgb(230, 240, 240), rgb(191, 221, 229), rgb(1... |
| 57 | gray | 12 | [rgb(0, 0, 0), rgb(16, 16, 16), rgb(38, 38, 38... |
| 59 | ice | 12 | [rgb(3, 5, 18), rgb(25, 25, 51), rgb(44, 42, 8... |
| 60 | matter | 12 | [rgb(253, 237, 176), rgb(250, 205, 145), rgb(2... |
| 61 | solar | 12 | [rgb(51, 19, 23), rgb(79, 28, 33), rgb(108, 36... |
| 62 | speed | 12 | [rgb(254, 252, 205), rgb(239, 225, 156), rgb(2... |
| 63 | tempo | 12 | [rgb(254, 245, 244), rgb(222, 224, 210), rgb(1... |
| 64 | thermal | 12 | [rgb(3, 35, 51), rgb(13, 48, 100), rgb(53, 50,... |
| 39 | RdBu | 11 | [rgb(103,0,31), rgb(178,24,43), rgb(214,96,77)... |
| 48 | Viridis | 10 | [#440154, #482878, #3e4989, #31688e, #26828e, ... |
| 23 | Magma | 10 | [#000004, #180f3d, #440f76, #721f81, #9e2f7f, ... |
| 20 | Inferno | 10 | [#000004, #1b0c41, #4a0c6b, #781c6d, #a52c60, ... |
| 30 | Plasma | 10 | [#0d0887, #46039f, #7201a8, #9c179e, #bd3786, ... |
| 12 | Cividis | 10 | [#00224e, #123570, #3b496c, #575d6d, #707173, ... |
| 49 | YlGn | 9 | [rgb(255,255,229), rgb(247,252,185), rgb(217,2... |
| 50 | YlGnBu | 9 | [rgb(255,255,217), rgb(237,248,177), rgb(199,2... |
| 42 | Reds | 9 | [rgb(255,245,240), rgb(254,224,210), rgb(252,1... |
| 51 | YlOrBr | 9 | [rgb(255,255,229), rgb(255,247,188), rgb(254,2... |
| 40 | RdPu | 9 | [rgb(255,247,243), rgb(253,224,221), rgb(252,1... |
| 38 | Rainbow | 9 | [rgb(150,0,90), rgb(0,0,200), rgb(0,25,255), r... |
| 36 | Purples | 9 | [rgb(252,251,253), rgb(239,237,245), rgb(218,2... |
| 34 | PuRd | 9 | [rgb(247,244,249), rgb(231,225,239), rgb(212,1... |
| 32 | PuBu | 9 | [rgb(255,247,251), rgb(236,231,242), rgb(208,2... |
| 52 | YlOrRd | 9 | [rgb(255,255,204), rgb(255,237,160), rgb(254,2... |
| 33 | PuBuGn | 9 | [rgb(255,247,251), rgb(236,226,240), rgb(208,2... |
| 18 | Greys | 9 | [rgb(255,255,255), rgb(240,240,240), rgb(217,2... |
| 4 | Blues | 9 | [rgb(247,251,255), rgb(222,235,247), rgb(198,2... |
| 26 | Oranges | 9 | [rgb(255,245,235), rgb(254,230,206), rgb(253,2... |
| 25 | OrRd | 9 | [rgb(255,247,236), rgb(254,232,200), rgb(253,2... |
| 8 | BuGn | 9 | [rgb(247,252,253), rgb(229,245,249), rgb(204,2... |
| 9 | BuPu | 9 | [rgb(247,252,253), rgb(224,236,244), rgb(191,2... |
| 16 | GnBu | 9 | [rgb(247,252,240), rgb(224,243,219), rgb(204,2... |
| 17 | Greens | 9 | [rgb(247,252,245), rgb(229,245,224), rgb(199,2... |
| 1 | Agsunset | 7 | [rgb(75, 41, 145), rgb(135, 44, 162), rgb(192,... |
| 5 | Blugrn | 7 | [rgb(196, 230, 195), rgb(150, 210, 164), rgb(1... |
| 6 | Bluyl | 7 | [rgb(247, 254, 174), rgb(183, 230, 165), rgb(1... |
| 7 | Brwnyl | 7 | [rgb(237, 229, 207), rgb(224, 194, 162), rgb(2... |
| 10 | Burg | 7 | [rgb(255, 198, 196), rgb(244, 163, 168), rgb(2... |
| 11 | Burgyl | 7 | [rgb(251, 230, 197), rgb(245, 186, 152), rgb(2... |
| 13 | Darkmint | 7 | [rgb(210, 251, 212), rgb(165, 219, 194), rgb(1... |
| 15 | Emrld | 7 | [rgb(211, 242, 163), rgb(151, 225, 150), rgb(1... |
| 29 | Pinkyl | 7 | [rgb(254, 246, 181), rgb(255, 221, 154), rgb(2... |
| 41 | Redor | 7 | [rgb(246, 210, 169), rgb(245, 183, 142), rgb(2... |
| 22 | Magenta | 7 | [rgb(243, 203, 211), rgb(234, 169, 189), rgb(2... |
| 28 | Peach | 7 | [rgb(253, 224, 197), rgb(250, 203, 166), rgb(2... |
| 35 | Purp | 7 | [rgb(243, 224, 247), rgb(228, 199, 241), rgb(2... |
| 27 | Oryel | 7 | [rgb(236, 218, 154), rgb(239, 196, 126), rgb(2... |
| 37 | Purpor | 7 | [rgb(249, 221, 218), rgb(242, 185, 196), rgb(2... |
| 24 | Mint | 7 | [rgb(228, 241, 225), rgb(180, 217, 204), rgb(1... |
| 0 | Aggrnyl | 7 | [rgb(36, 86, 104), rgb(15, 114, 121), rgb(13, ... |
| 43 | Sunset | 7 | [rgb(243, 231, 155), rgb(250, 196, 132), rgb(2... |
| 44 | Sunsetdark | 7 | [rgb(252, 222, 156), rgb(250, 164, 118), rgb(2... |
| 45 | Teal | 7 | [rgb(209, 238, 234), rgb(168, 219, 217), rgb(1... |
| 46 | Tealgrn | 7 | [rgb(176, 242, 188), rgb(137, 232, 172), rgb(1... |
| 21 | Jet | 6 | [rgb(0,0,131), rgb(0,60,170), rgb(5,255,255), ... |
| 14 | Electric | 6 | [rgb(0,0,0), rgb(30,0,100), rgb(120,0,100), rg... |
| 2 | Blackbody | 5 | [rgb(0,0,0), rgb(230,0,0), rgb(230,210,0), rgb... |
| 19 | Hot | 4 | [rgb(0,0,0), rgb(230,0,0), rgb(255,210,0), rgb... |
| 3 | Bluered | 2 | [rgb(0,0,255), rgb(255,0,0)] |
#normal scale
xp.colors.sequential.Viridis
#reverse scale _r
xp.colors.sequential.Viridis_r
fig = xp.scatter(df,height=360, width=None,x='petal_length', y='sepal_length',
color='petal_length', template= 'plotly_dark',
title= 'Viridis Scale',
color_continuous_scale= xp.colors.sequential.Viridis)
fig
next(c_scatter)
next(c_scatter)
next(c_scatter)
next(c_scatter)
next(c_scatter)
next(c_scatter)
next(c_scatter)
next(c_scatter)
next(c_scatter)
next(c_scatter)
next(c_scatter)
next(c_scatter)
next(c_scatter)
next(c_scatter)
next(c_scatter)
next(c_scatter)
next(c_scatter)
next(c_scatter)
next(c_scatter)
next(c_scatter)
next(c_scatter)
next(c_scatter)
next(c_scatter)
next(c_scatter)
next(c_scatter)
next(c_scatter)
next(c_scatter)
next(c_scatter)
next(c_scatter)
next(c_scatter)
next(c_scatter)
next(c_scatter)
next(c_scatter)
next(c_scatter)
next(c_scatter)
next(c_scatter)
next(c_scatter)
next(c_scatter)
next(c_scatter)
next(c_scatter)
next(c_scatter)
next(c_scatter)
next(c_scatter)
next(c_scatter)
next(c_scatter)
next(c_scatter)
next(c_scatter)
next(c_scatter)
next(c_scatter)
next(c_scatter)
next(c_scatter)
next(c_scatter)
next(c_scatter)
next(c_scatter)
next(c_scatter)
next(c_scatter)
next(c_scatter)
next(c_scatter)
next(c_scatter)
next(c_scatter)
next(c_scatter)
next(c_scatter)
next(c_scatter)
next(c_scatter)
next(c_scatter)
next(c_scatter)
fig2 = xp.pie(df2.head(15),height=450, width=1000, hole=.40,
names='district', values='total', color='district',
template= 'plotly_dark', title= 'Turbo : 15',
color_discrete_sequence= xp.colors.sequential.Turbo)
fig2
next(d_pie)
next(d_pie)
next(d_pie)
next(d_pie)
next(d_pie)
next(d_pie)
next(d_pie)
next(d_pie)
next(d_pie)
next(d_pie)
next(d_pie)
next(d_pie)
next(d_pie)
next(d_pie)
next(d_pie)
next(d_pie)
next(d_pie)
next(d_pie)
next(d_pie)
next(d_pie)
next(d_pie)
next(d_pie)
next(d_pie)
next(d_pie)
next(d_pie)
next(d_pie)
next(d_pie)
next(d_pie)
next(d_pie)
next(d_pie)
next(d_pie)
next(d_pie)
next(d_pie)
next(d_pie)
next(d_pie)
next(d_pie)
next(d_pie)
next(d_pie)
next(d_pie)
next(d_pie)
next(d_pie)
next(d_pie)
next(d_pie)
next(d_pie)
next(d_pie)
next(d_pie)
next(d_pie)
next(d_pie)
next(d_pie)
next(d_pie)
next(d_pie)
next(d_pie)
next(d_pie)
next(d_pie)
next(d_pie)
next(d_pie)
next(d_pie)
next(d_pie)
next(d_pie)
next(d_pie)
next(d_pie)
next(d_pie)
next(d_pie)
next(d_pie)
next(d_pie)
next(d_pie)
In Plotly, the colors.diverging module provides users with a range of pre-defined color scales that are optimized for use in diverging data visualizations. These color scales are specifically designed to effectively represent data sets where there is a clear midpoint or threshold, and where both positive and negative values are present.
The colors.diverging module includes a variety of color scales that can be used in different contexts. For example, the RdBu scale includes a range of red and blue hues that gradually increase in intensity in opposite directions, making it ideal for visualizing data with a clear midpoint or threshold. On the other hand, the Spectral scale includes a range of colors that gradually increase in intensity, but with more distinct hues, making it ideal for visualizing data with a more complex distribution.
xp.colors.diverging.swatches_continuous().update_layout(template='plotly_dark')
This is a comprehensive dataset that includes all available color scales for the colors.diverging module in Plotly. This dataset contains color scales that are optimized for use in sequential data visualizations, making it ideal for creating informative and aesthetically pleasing plots.
The dataset includes:
diverging_df
| scale | size | codes | |
|---|---|---|---|
| 21 | oxy | 12 | [rgb(63, 5, 5), rgb(101, 6, 13), rgb(138, 17, ... |
| 20 | delta | 12 | [rgb(16, 31, 63), rgb(38, 62, 144), rgb(30, 11... |
| 19 | curl | 12 | [rgb(20, 29, 67), rgb(28, 72, 93), rgb(18, 115... |
| 18 | balance | 12 | [rgb(23, 28, 66), rgb(41, 58, 143), rgb(11, 10... |
| 10 | RdBu | 11 | [rgb(103,0,31), rgb(178,24,43), rgb(214,96,77)... |
| 14 | Spectral | 11 | [rgb(158,1,66), rgb(213,62,79), rgb(244,109,67... |
| 13 | RdYlGn | 11 | [rgb(165,0,38), rgb(215,48,39), rgb(244,109,67... |
| 12 | RdYlBu | 11 | [rgb(165,0,38), rgb(215,48,39), rgb(244,109,67... |
| 1 | BrBG | 11 | [rgb(84,48,5), rgb(140,81,10), rgb(191,129,45)... |
| 11 | RdGy | 11 | [rgb(103,0,31), rgb(178,24,43), rgb(214,96,77)... |
| 9 | PuOr | 11 | [rgb(127,59,8), rgb(179,88,6), rgb(224,130,20)... |
| 7 | Picnic | 11 | [rgb(0,0,255), rgb(51,153,255), rgb(102,204,25... |
| 6 | PiYG | 11 | [rgb(142,1,82), rgb(197,27,125), rgb(222,119,1... |
| 5 | PRGn | 11 | [rgb(64,0,75), rgb(118,42,131), rgb(153,112,17... |
| 15 | Tealrose | 7 | [rgb(0, 147, 146), rgb(114, 170, 161), rgb(177... |
| 16 | Temps | 7 | [rgb(0, 147, 146), rgb(57, 177, 133), rgb(156,... |
| 17 | Tropic | 7 | [rgb(0, 155, 158), rgb(66, 183, 185), rgb(167,... |
| 4 | Geyser | 7 | [rgb(0, 128, 128), rgb(112, 164, 148), rgb(180... |
| 3 | Fall | 7 | [rgb(61, 89, 65), rgb(119, 136, 104), rgb(181,... |
| 2 | Earth | 7 | [rgb(161, 105, 40), rgb(189, 146, 90), rgb(214... |
| 0 | Armyrose | 7 | [rgb(121, 130, 52), rgb(163, 173, 98), rgb(208... |
| 8 | Portland | 5 | [rgb(12,51,131), rgb(10,136,186), rgb(242,211,... |
#normal scale
xp.colors.diverging.delta
#reverse scale _r
xp.colors.diverging.delta_r